#########################################################################################
## 
## Hack Title:    Text field instead of input field
## Author:        Acid
##
## Description:   If you want to have a text field that supports bbcode, html and smilees
##		  instead of an input field..
##		  If you want to have several text fields duplicate the following
##		  steps and change "info" (be aware of the spelling).
##		  The field "info" is just an example.
##
## Files to edit:  5
##		   admin/admin_users.php
##		   includes/usercp_register.php
##		   includes/usercp_viewprofile.php
##                 templates/xxx/admin/user_edit_body.tpl
##     	           templates/xxx/profile_add_body.tpl
##
#########################################################################################
## 
## Installation/Author Notes: 
## First always backup the files/database that you're going to edit. 
## 
## This hacks adds two new columns to the 'user' table. 
## 
#########################################################################################
#
#-----[ SQL ]-------------------------------------------
#  
# You have to execute the following queries via phpmyadmin (change prefix)..

# If you havent already added a new field..
ALTER TABLE phpbb_users ADD user_info TEXT AFTER user_interests;
ALTER TABLE phpbb_users ADD user_info_bbcode_uid VARCHAR (255) AFTER user_info;

# If you want to change an existing field..
ALTER TABLE phpbb_users CHANGE user_info user_info TEXT;
ALTER TABLE phpbb_users ADD user_info_bbcode_uid VARCHAR (255) AFTER user_info;

# If youre going to add/change several fields duplicate the above queries and 
# change the field names "user_info".
#
#########################################################################################
# 
#-----[ OPEN ]------------------------------------------ 
#  
# includes/usercp_viewprofile.php
# 
#-----[ FIND ]---------------------------------------------------
# 
$page_title = $lang['Viewing_profile'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

# 
#-----[ BELOW ADD ]---------------------------------------------------
# 
include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);
$info = (  $profiledata['user_info'] != '' ) ? $profiledata['user_info'] : '';
$info_bbcode_uid = $profiledata['user_info_bbcode_uid'];

if( !$board_config['allow_html'] )
{
	if( $info != '' && $userdata['user_allowhtml'] )
	{
		$info = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $info);
	}
}

if( $board_config['allow_bbcode'] )
{
        if( $info != '' && $info_bbcode_uid != '' )
        {
                $info = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($info, $info_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $info);
        }
}
if( $board_config['allow_smilies'] )
{
        if ( $profiledata['user_allowsmile'] && $info != '' )
        {
                $info = smilies_pass($info);
        }
}
$info = str_replace("\n", "\n<br />\n", $info);
$info = make_clickable($info);

# 
#-----[ FIND ]---------------------------------------------------
# 
	'INFO' => ( $profiledata['user_info'] ) ? $profiledata['user_info'] : '&nbsp;',

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
	'INFO' => $info,



# 
#-----[ OPEN ]------------------------------------------
#  
# includes/usercp_register.php
# 
#-----[ FIND ]---------------------------------------------------
# 
	$strip_var_list = array('username' => 'username', 'email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests');
# 
#-----[ IN-LINE FIND and DELETE ]---------------------------------------------------
# 
, 'info' => 'info'

# 
#-----[ FIND ]---------------------------------------------------
# 
	$trim_var_list = array('cur_password' => 'cur_password', 'new_password' => 'new_password', 'password_confirm' => 'password_confirm', 'signature' => 'signature');

# 
#-----[ IN-LINE FIND ]---------------------------------------------------
# 
, 'signature' => 'signature'

# 
#-----[ AFTER ADD ]---------------------------------------------------
# 
, 'info' => 'info'

# 
#-----[ FIND ]---------------------------------------------------
# 
		$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
	}

# 
#-----[ BELOW ADD ]---------------------------------------------------
# 
	if ( $info != '' )
	{
		if ( $info_bbcode_uid == '' )
		{
			$info_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
		}
		$info = prepare_message($info, $allowhtml, $allowbbcode, $allowsmilies, $info_bbcode_uid);
	}

# 
#-----[ FIND (just a quote) ]---------------------------------------------------
# 
			$sql = "UPDATE " . USERS_TABLE . "
# 
#-----[ IN-LINE FIND ]---------------------------------------------------
# 
, user_info = '" . str_replace("\'", "''", $info) . "'

# 
#-----[ AFTER ADD ]---------------------------------------------------
# 
, user_info_bbcode_uid = '$info_bbcode_uid'

# 
#-----[ FIND (just a quote) ]---------------------------------------------------
# 
			$sql = "INSERT INTO " . USERS_TABLE . "

# 
#-----[ IN-LINE FIND ]---------------------------------------------------
# 
, user_info

# 
#-----[ AFTER ADD ]---------------------------------------------------
# 
, user_info_bbcode_uid

# 
#-----[ IN-LINE FIND ]---------------------------------------------------
# 
, '" . str_replace("\'", "''", $info) . "'

# 
#-----[ AFTER ADD ]---------------------------------------------------
# 
, '$info_bbcode_uid'

# 
#-----[ FIND ]---------------------------------------------------
# 
	$info = $userdata['user_info'];

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
	$info_bbcode_uid = $userdata['user_info_bbcode_uid'];
	$info = ( $info_bbcode_uid != '' ) ? preg_replace("/:(([a-z0-9]+:)?)$info_bbcode_uid\]/si", ']', $userdata['user_info']) : $userdata['user_info'];

# 
#-----[ FIND ]---------------------------------------------------
# 
		'INFO' => $info,

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
      		'INFO' => str_replace('<br />', "\n", $info),



# 
#-----[ OPEN ]------------------------------------------
#  
# admin/admin_users.php
# 
#-----[ FIND ]---------------------------------------------------
# 
		$info = ( !empty($HTTP_POST_VARS['info']) ) ? trim(strip_tags( $HTTP_POST_VARS['info'] ) ) : ''; 

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
		$info = ( !empty($HTTP_POST_VARS['info']) ) ? trim(str_replace('<br />', "\n", $HTTP_POST_VARS['info'] ) ) : ''; 

# 
#-----[ FIND ]---------------------------------------------------
# 
		//
		// Avatar stuff
		//

# 
#-----[ ABOVE ADD ]---------------------------------------------------
# 
		if( $info != "" )
		{
			if ( $info_bbcode_uid == '' )
			{
				$info_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
			}
			$info = prepare_message($info, $allowhtml, $allowbbcode, $allowsmilies, $info_bbcode_uid);
		}

# 
#-----[ FIND (just a quote) ]---------------------------------------------------
# 
			$sql = "UPDATE " . USERS_TABLE . "
# 
#-----[ IN-LINE FIND ]---------------------------------------------------
# 
, user_info = '" . str_replace("\'", "''", $info) . "'

# 
#-----[ AFTER ADD ]---------------------------------------------------
# 
, user_info_bbcode_uid = '$info_bbcode_uid'

# 
#-----[ FIND ]---------------------------------------------------
# 
		$info = htmlspecialchars($this_userdata['user_info']);

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
		$info = ($this_userdata['user_info_bbcode_uid'] != '') ? preg_replace('#:' . $this_userdata['user_info_bbcode_uid'] . '#si', '', $this_userdata['user_info']) : $this_userdata['user_info'];
		$info = preg_replace($html_entities_match, $html_entities_replace, $info);

# 
#-----[ FIND ]---------------------------------------------------
# 
			'INFO' => $info, 

# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
			'INFO' => str_replace('<br />', "\n", $info),



# 
#-----[ OPEN ]------------------------------------------
#  
# templates/xxx/admin/user_edit_body.tpl
# templates/xxx/profile_add_body.tpl
# 
#-----[ FIND ]---------------------------------------------------
# 
          <td class="row2"> <input class="post" type="text" name="info" size="35" maxlength="50" value="{INFO}" /> /td> 
# 
#-----[ REPLACE WITH ]---------------------------------------------------
# 
	  <td class="row2"><textarea name="info" style="width: 300px"  rows="6" cols="30" class="post">{INFO}</textarea></td>

#########################################################################################
#########################################################################################
#########################################################################################